package com.awesome.uidemo.eventdispatch;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

import com.awesome.common.util.log.ShowLogUtil;
import com.awesome.uidemo.R;

/**
 * Author: zhangjingfang
 * Email:zhangjingfang@jeejio.com
 * Date: 2022/1/5
 * Description:
 */
public class NormalTouchActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_normal_touch);
        TextView textView = findViewById(R.id.tv);
        textView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()){
                    case MotionEvent.ACTION_DOWN:
                        ShowLogUtil.info("ACTION_DOWN");
                        break;
                    case MotionEvent.ACTION_MOVE:
                        ShowLogUtil.info("ACTION_MOVE");
                        break;
                    case MotionEvent.ACTION_UP:
                        ShowLogUtil.info("ACTION_UP");
                        break;
                    case MotionEvent.ACTION_CANCEL:
                        ShowLogUtil.info("ACTION_CANCEL");
                        break;
                }
                return false;
            }
        });
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ShowLogUtil.info("setOnClickListener");
            }
        });
    }
}